﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using DailyDiet.Services;
using DailyDiet.Views;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using Xamarin.Forms;

namespace DailyDiet.ViewModels
{
    public class AppShellViewModel : ViewModelBase {
        private IPreferenceStorage _preference;
        private IDietStorageService _dietStorage;
        private IDietRecorderStorageService _dietRecorderStorage;
        private IFavoriteStorageService _favoriteStorage;

        private TabBar _tabBar;

        public TabBar TabBar {
            get => _tabBar;
            set => Set(nameof(TabBar), ref _tabBar, value);
        }


        private RelayCommand _appearCommand;

        public RelayCommand AppearCommand =>
            _appearCommand ?? (_appearCommand =
                new RelayCommand(async () => await AppearCommandFunc()));

        private async Task AppearCommandFunc() {
            Routing.RegisterRoute(nameof(HealthInfoPage), typeof(HealthInfoPage));
        }

        public AppShellViewModel(IPreferenceStorage preferenceStorage,
            IDietStorageService dietStorageService,
            IFavoriteStorageService favoriteStorageService,
            IDietRecorderStorageService dietRecorderStorage)
        {

            _preference = preferenceStorage;
            _dietRecorderStorage = dietRecorderStorage;
            _dietStorage = dietStorageService;
            _preference = preferenceStorage;
            _favoriteStorage = favoriteStorageService;
        }
    }
}
